<?php
namespace app\duxcms\controller;
use app\home\controller\SiteController;
/**
 * 表单列表
 */

class UserController extends SiteController {

    public function login(){
        $account = request("post.account");
        $userpass = request("post.userpass");
        if($UserInfo = target("Admin/Users")->getUserInfo($account,$userpass)){
            session("UserInfo",$UserInfo);
            if(empty($formInfo['post_return_url'])){
                $url =  $_SERVER["HTTP_REFERER"];
            }else{
                $url = $formInfo['post_return_url'];
            }
            $this->success("登录成功！",$url);
        }else{
            $this->error("登录失败，".target("Admin/Users")->getError());
        }
    }

    public function logout(){
        session("UserInfo",null);
    }
}
